#pragma once

#include "resource.h"       // main symbols
#include <string>
#include <list>
#include <map>
#include <gdiplus.h>

#undef INTSAFE_E_ARITHMETIC_OVERFLOW

using namespace std;
using namespace Gdiplus;

#define MAX_MENU_ICONS 64

// CShellExtAssistent

enum FileOps
{
	MenuSeparator = 0,
	ExtractFilesToFolder,
	ExtractFilesFromFolder,
	CopyFiles,
	MoveFiles,
	MoveUp,
	DeleteZeroLengthFiles,
	InvertSelection,
	CopyFilePath,
	Touch,
	FilesListDetailed,
	FilesListDetailedFullPath,
	FilesListSimple,
	FilesListSimpleFullPath,
	EncryptFiles,
	DecryptFiles,
	SplitFiles,
	JoinFiles,
	RenameFindReplace,
	RenameAutoNumbering,
	RenameAlphabetize,
	RenameAppend,
	RenameAutoNumberingWithAppend,
	RenameAlphabetizeWithAppend,
	RenameMakeSameName,
	RenameTruncate,
	ShrinkImageFiles,
	ShrinkImageFiles25,
	ShrinkImageFiles50,
	ShrinkImageFiles75,
	ShrinkImageFiles25Jpg,
	ShrinkImageFiles50Jpg,
	ShrinkImageFiles75Jpg,
	ShrinkImageFiles100Jpg,
	AddLogoToImage,
	PdfImageAlbum,
	PdfImageAlbumPhotoWallet,
	PdfImageAlbumPhoto3_5x5,
	PdfImageAlbumPhoto4x6,
	PdfImageAlbumPhoto5x7,
	PdfImageAlbumPhoto8x10,
	PdfImageAlbumPhoto9x12,
	PdfImageAlbumTwice8x10,
	PdfImageAlbumQuad4x6,
	SortDesktop,
	SortDesktopRedo,
	SortDesktopEggPlant,
	SortDesktopSunset,
	SortDesktopDark,
	SortDesktopBlueSky,
	// Not included in Favorites
	About,
	Settings,
	CopyFilesRecent00,
	CopyFilesRecent01,
	CopyFilesRecent02,
	CopyFilesRecent03,
	CopyFilesRecent04,
	MoveFilesRecent00,
	MoveFilesRecent01,
	MoveFilesRecent02,
	MoveFilesRecent03,
	MoveFilesRecent04,
	Contents,
	ManageFavorites,
	None,
};

enum MenuPics
{
	ICON_NONE = 0,
	ICON_COPY,
	ICON_DECRYPT,
	ICON_DELETE,
	ICON_ENCRYPT,
	ICON_EXTRACT_FROM,
	ICON_EXTRACT_TO,
	ICON_TOUCH,
	ICON_JOIN,
	ICON_LIST_FULL,
	ICON_LIST_SIMPLE,
	ICON_PICTURES,
	ICON_IMAGE_TOPIC,
	ICON_IMAGE_SAVE,
	ICON_IMAGE_EDIT,
	ICON_FROG,
	ICON_RENAME,
	ICON_SECURITY,
	ICON_SPLIT,
	ICON_HELP,
	ICON_BOOK,
	ICON_HEART,
	ICON_FAV,
	ICON_SHRINK,
	ICON_MOVE,
	ICON_ORGANIZE,
	ICON_PDF,
	ICON_REN_ABC,
	ICON_REN_NUM,
	ICON_REN_REPLACE,
	ICON_REN_TRUNC,
	ICON_SPLIT_JOIN,
	ICON_SEPARATOR,
	ICON_SETTINGS,
	ICON_INVERT,
	ICON_COPY_PATH,
	ICON_SORT_DESKTOP,
	ICON_SORT_DESKTOP_REDO,
	ICON_THEME_DARK,
	ICON_THEME_EGGPLANT,
	ICON_THEME_SKY,
	ICON_THEME_SUNSET,
	ICON_MOVE_UP,
	ICON_ABOUT,
};

class MenuItemsHolder
{
public:
	MenuItemsHolder();
	~MenuItemsHolder();

	// Menu Items
	map<FileOps, wstring> m_CmdText;
	map<FileOps, MenuPics> m_CmdIcon;
	// Menu Drawing
	HICON m_Icons[MAX_MENU_ICONS];
	HBITMAP m_Bitmaps[MAX_MENU_ICONS];
private:

	// GDI Plus
	GdiplusStartupInput m_GdiPlusStartupInput;
	ULONG_PTR m_GdiPlusToken;

	static bool HasAlpha(HBITMAP hbm);
	static HBITMAP ConvertDDBToDIB(HBITMAP hbm);
	static HBITMAP CreatePARGBFromHICON(HICON hIcon, UINT size);
	static HBITMAP IconToBitmapPARGB32(HICON hIcon);
};
